﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace GTA
{
    public class Background
    {
        Texture2D[] backgroundTab = new Texture2D[1];
        Vector2[] backgroundStartingPos = new Vector2[1];
        int selectedBackground = 0; // First level background

        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }
        Vector2 position;

        public Background()
        {

        }

        public void InitBackground(ContentManager Content)
        {
            // Loading background images
            backgroundTab[0] = Content.Load<Texture2D>("Background/background1");

            // Setting background positions
            backgroundStartingPos[0] = new Vector2(0, 0);
        }

        public void Update()
        {

        }

        public void DrawBackground(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(backgroundTab[selectedBackground], position, Color.White);
        }

        /* Custom function */
        public void SwapBackground(int backgroundNumber)
        {
            selectedBackground = backgroundNumber;
            position = backgroundStartingPos[selectedBackground];
        }
    }
}
